package org.lionsoul.websnail.listener;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lionsoul.websnail.Spider;

/**
 * default spider listener
 *
 * @author chenxin<chenxin619315 @ gmail.com>
 */
public class DefaultSpiderListener implements SpiderListener {

    private static final Logger logger = LogManager.getLogger(DefaultSpiderListener.class);

    @Override
    public void onStartup(Spider spider) {
        logger.info("WebSnail Spider started.");
    }

    @Override
    public void onPause(Spider spider) {
        logger.info("Spider is paused, waiting for resume.");
    }

    @Override
    public void onResume(Spider spider) {
        logger.info("Spider is resumed, go ahead.");
    }

    @Override
    public void onFinish(Spider spider) {
        logger.info("Hey, buddy!");
        logger.info("All the works were accomplished, and i shut myself down!");
        logger.info("^_^, Have a nice day!");
        spider.shutdown();
    }

    @Override
    public void onShutdown(Spider spider) {
    }
}
